﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;

namespace DBMS.Models
{
    [Serializable()]
    public class Value : ISerializable
    {
        public int Id { get; set; }

        public int RowId { get; set; }

        //public Column Column { get; set; }

        public int ColumnId { get; set; }

        public string ConcreteValue { get; set; }

        public bool Deleted { get; set; }

        public Value() { }

        public Value(SerializationInfo info, StreamingContext ctxt)
        {
            this.Id = (int)info.GetValue("Id", typeof(int));
            this.RowId = (int)info.GetValue("RowId", typeof(int));
            //this.Column = (Column)info.GetValue("Column", typeof(Column));
            this.ColumnId = (int)info.GetValue("ColumnId", typeof(int));
            this.ConcreteValue = (string)info.GetValue("ConcreteValue", typeof(string));
            this.Deleted = (bool)info.GetValue("Deleted", typeof(bool));
        }

        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("Id", this.Id);
            info.AddValue("RowId", this.RowId);
            //info.AddValue("Column", this.Column);
            info.AddValue("ColumnId", this.ColumnId);
            info.AddValue("ConcreteValue", this.ConcreteValue);
            info.AddValue("Deleted", this.Deleted);            
        }
    }
}
